<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<div class="well">所有学院信息如下</div>
	<table class="table table-striped table-bordered" id="college_list_table">
		<thead>
		 <tr role="row">
		 	<th >学院编号</th>
		 	<th>学院名</th>
		 	<th>更多</th>
		 </tr>
		</thead>   
		<tbody>
		<c:forEach items="${colleges }" var="c">
			<tr>
				<td>${c.no }</td>
				<td>${c.name }</td>
				<td>
				<button type="button" class="btn btn-info college_edit" data-collegeId="${c.id }" data-target="#college_edit_box" data-toggle="modal" >
					<i class="icon-edit icon-white"></i>  
					编辑
				</button>
				<c:if test="${fn:length(colleges)>1}">
					<button type="button" class="btn btn-danger college_delete"  data-target="#college_delete_box" data-toggle="modal" data-collegeId="${c.id }">
						<i class="icon-trash icon-white"></i>  
						删除
					</button>
				</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="well">
		<button type="button" class="btn btn-primary" id="college_add"  data-target="#college_add_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			新建一个学院
		</button>
	</div>
</div>
<!-- 信息修改 开始 -->
<div class="modal hide fade" id="college_edit_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>编辑</h3>
	</div>
	<div class="modal-body">
		<div  class="ajax_wait" style="text-align: center;"><img src="<%=basePath %>images/ajax-loader.gif" title="wait" /></div>
		<div id="college_edit_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="college_edit_box_form" style="display: none;">
			<input name="college_id"size="16" type="hidden">
			<div class="control-group">
				<label class="control-label">学院编号</label>
				<div class="controls">
					<input name="college_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">学院名</label>
				<div class="controls">
					<input name="college_name"size="16" type="text">
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="college_edit_box_save">保存</a>
	</div>
</div>
<!-- 信息修改 结束 -->
<!-- 删除确认 开始-->
<div class="modal hide fade" id="college_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除学院</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="collegeId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="college_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!-- 添加 开始 -->
<div class="modal hide fade" id="college_add_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>新建一个学院</h3>
	</div>
	<div class="modal-body">
		<div id="college_add_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="college_add_box_form">
			<div class="control-group">
				<label class="control-label">学院编号</label>
				<div class="controls">
					<input name="college_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">学院名</label>
				<div class="controls">
					<input name="college_name"size="16" type="text">
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="college_add_box_save">保存</a>
	</div>
</div>
<!-- 添加 结束 -->